
import java.util.*;


public class Test8 {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        // 注意 hasNext 和 hasNextLine 的区别
        while (in.hasNext()) { // 注意 while 处理多个 case
            int n = in.nextInt();
            int m = in.nextInt();
            char[][] grid = new char[n][m];
            for (int i = 0; i < n; i++) {
                String st=in.next();
                for(int j=0;j<m;j++){
                    grid[i][j] =st.charAt(j);
                }

            }
            int a=findMax(grid,n,m);
            System.out.println(a);
        }
    }
    public static int findMax(char[][] grid,int j,int k) {
        if (grid.length == 1 && grid[0].length == 1) {
            if (grid[0][0] == 'l') {
                return 4;
            }
            if (grid[0][0] == 'o') {
                return 3;
            }
            if (grid[0][0] == 'v') {
                return 2;
            }
            if (grid[0][0] == 'e') {
                return 1;
            }
        }
        if(j< grid.length-1 && k< grid[0].length-1){
            return Math.max(findMax(grid,j+1,k),findMax(grid,j,k+1));
        }else{
            if(j< grid.length-1 && k>= grid[0].length-1){
                return findMax(grid,j+1,k);
            }else{
                return findMax(grid,j,k+1);
            }
        }


    }








    public static void main01(String[] args) {
        Scanner in = new Scanner(System.in);
        // 注意 hasNext 和 hasNextLine 的区别
        while (in.hasNextInt()) { // 注意 while 处理多个 case
            int a = in.nextInt();
            int m = a;
            int b = in.nextInt();
            int n = b;
            int c = b % a;
            while (c != 0 ) {
                b = a;
                a = c;
                c = b % a;
                if( c == 1){
                    break;
                }
            }
            if (c == 0) {
                System.out.println(m * n / a);
            }
            if (c == 1) {
                System.out.println(m * n);
            }

        }
    }
}
